package com.ngm.tea.common;

import org.springframework.util.StringUtils;

/*
 * 分页参数实体类
 */

public class PageInfo {

	private int pageCurrent;

	private int pageSize;

	private int pageStart;

	private String orderField;

	private String orderDirection;

	public PageInfo() {

	}

	public PageInfo(int pageCurrent, int pageSize, String orderField, String orderDirection) {
		this.pageCurrent = pageCurrent == 0 ? 1 : pageCurrent;
		this.pageSize = pageSize == 0 ? 10 : pageSize;
		this.orderField = StringUtils.isEmpty(orderField) ? "id" : orderField;
		this.orderDirection = StringUtils.isEmpty(orderDirection) ? "asc" : orderDirection;
		pageStart = (pageCurrent - 1) * pageSize;
	}

	public int getPageCurrent() {
		return pageCurrent;
	}

	public void setPageCurrent(int pageCurrent) {
		this.pageCurrent = pageCurrent;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public String getOrderField() {
		return orderField;
	}

	public void setOrderField(String orderField) {
		this.orderField = orderField;
	}

	public String getOrderDirection() {
		return orderDirection;
	}

	public void setOrderDirection(String orderDirection) {
		this.orderDirection = orderDirection;
	}

}